| | | 1 | | // Copyright (c) 2020-2023 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | using System; |
| | | 6 | | using UnityEngine; |
| | | 7 | | |
| | | 8 | | namespace GDX |
| | | 9 | | { |
| | | 10 | | public class SimpleTable : ScriptableObject |
| | | 11 | | { |
| | | 12 | | public struct SimpleTableRowRef |
| | | 13 | | { |
| | | 14 | | public SimpleTable Table; |
| | | 15 | | public int RowID; |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | public enum ColumnType |
| | | 19 | | { |
| | | 20 | | Invalid = -1, |
| | | 21 | | String, |
| | | 22 | | Char, |
| | | 23 | | Bool, |
| | | 24 | | Sbyte, |
| | | 25 | | Byte, |
| | | 26 | | Short, |
| | | 27 | | Ushort, |
| | | 28 | | Int, |
| | | 29 | | Uint, |
| | | 30 | | Long, |
| | | 31 | | Ulong, |
| | | 32 | | Float, |
| | | 33 | | Double, |
| | | 34 | | Vector2, |
| | | 35 | | Vector3, |
| | | 36 | | Vector4, |
| | | 37 | | Vector2Int, |
| | | 38 | | Vector3Int, |
| | | 39 | | Quaternion, |
| | | 40 | | Rect, |
| | | 41 | | RectInt, |
| | | 42 | | Color, |
| | | 43 | | LayerMask, |
| | | 44 | | Bounds, |
| | | 45 | | BoundsInt, |
| | | 46 | | Hash128, |
| | | 47 | | Gradient, |
| | | 48 | | AnimationCurve, |
| | | 49 | | Object, |
| | | 50 | | Count |
| | | 51 | | } |
| | | 52 | | |
| | | 53 | | public struct ColumnEntry |
| | | 54 | | { |
| | | 55 | | public ColumnType columnType; |
| | | 56 | | public int columnDenseIndex; |
| | | 57 | | } |
| | | 58 | | |
| | | 59 | | internal string[][] allStringColumns; |
| | | 60 | | internal bool[][] allBoolColumns; |
| | | 61 | | internal char[][] allCharColumns; |
| | | 62 | | internal sbyte[][] allSbyteColumns; |
| | | 63 | | internal byte[][] allByteColumns; |
| | | 64 | | internal short[][] allShortColumns; |
| | | 65 | | internal ushort[][] allUshortColumns; |
| | | 66 | | internal int[][] allIntColumns; |
| | | 67 | | internal uint[][] allUintColumns; |
| | | 68 | | internal long[][] allLongColumns; |
| | | 69 | | internal ulong[][] allUlongColumns; |
| | | 70 | | internal float[][] allFloatColumns; |
| | | 71 | | internal double[][] allDoubleColumns; |
| | | 72 | | internal Vector2[][] allVector2Columns; |
| | | 73 | | internal Vector3[][] allVector3Columns; |
| | | 74 | | internal Vector4[][] allVector4Columns; |
| | | 75 | | internal Vector2Int[][] allVector2IntColumns; |
| | | 76 | | internal Vector3Int[][] allVector3IntColumns; |
| | | 77 | | internal Quaternion[][] allQuaternionColumns; |
| | | 78 | | internal Rect[][] allRectColumns; |
| | | 79 | | internal RectInt[][] allRectIntColumns; |
| | | 80 | | internal Color[][] allColorColumns; |
| | | 81 | | internal LayerMask[][] allLayerMaskColumns; |
| | | 82 | | internal Bounds[][] allBoundsColumns; |
| | | 83 | | internal BoundsInt[][] allBoundsIntColumns; |
| | | 84 | | internal Hash128[][] allHash128Columns; |
| | | 85 | | internal Gradient[][] allGradientColumns; |
| | | 86 | | internal AnimationCurve[][] allAnimationCurveColumns; |
| | | 87 | | internal UnityEngine.Object[][] allObjectRefColumns; |
| | | 88 | | |
| | 0 | 89 | | internal string[][] allColumnNames = new string[(int)ColumnType.Count][]; // Contains the name of each column of |
| | 0 | 90 | | internal int[][] allColumnOrders = new int[(int)ColumnType.Count][]; // Contains the left-to-right order of each |
| | | 91 | | |
| | | 92 | | internal string[] allRowNames; |
| | | 93 | | internal int rowCount; |
| | | 94 | | |
| | | 95 | | internal ColumnEntry[] columnIDToDenseIndexMap; |
| | 0 | 96 | | internal int[][] columnDenseIndexToIDMap = new int[(int)ColumnType.Count][]; |
| | | 97 | | internal int columnEntriesFreeListHead; |
| | | 98 | | |
| | | 99 | | internal int combinedColumnCount; |
| | | 100 | | |
| | | 101 | | public void AddRow(string rowName = null, int insertAt = -1) |
| | 0 | 102 | | { |
| | 0 | 103 | | insertAt = insertAt < 0 ? rowCount : insertAt; |
| | | 104 | | |
| | 0 | 105 | | Array.Resize(ref allRowNames, rowCount + 1); |
| | 0 | 106 | | for (int i = rowCount; i > insertAt; i--) |
| | 0 | 107 | | { |
| | 0 | 108 | | allRowNames[i] = allRowNames[i - 1]; |
| | 0 | 109 | | } |
| | | 110 | | |
| | 0 | 111 | | rowName ??= string.Empty; |
| | 0 | 112 | | allRowNames[insertAt] = rowName; |
| | | 113 | | |
| | 0 | 114 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, 1); |
| | 0 | 115 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, 1); |
| | 0 | 116 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, 1); |
| | 0 | 117 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, 1); |
| | 0 | 118 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, 1); |
| | 0 | 119 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, 1); |
| | 0 | 120 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, 1); |
| | 0 | 121 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, 1); |
| | 0 | 122 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, 1); |
| | 0 | 123 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, 1); |
| | 0 | 124 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, 1); |
| | 0 | 125 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, 1); |
| | 0 | 126 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, 1); |
| | 0 | 127 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, 1); |
| | 0 | 128 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, 1); |
| | 0 | 129 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, 1); |
| | 0 | 130 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, 1); |
| | 0 | 131 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, 1); |
| | 0 | 132 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, 1); |
| | 0 | 133 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, 1); |
| | 0 | 134 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, 1); |
| | 0 | 135 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, 1); |
| | 0 | 136 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, 1); |
| | 0 | 137 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, 1); |
| | 0 | 138 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, 1); |
| | 0 | 139 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, 1); |
| | 0 | 140 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, 1); |
| | 0 | 141 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, 1); |
| | 0 | 142 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, 1); |
| | | 143 | | |
| | 0 | 144 | | ++rowCount; |
| | 0 | 145 | | } |
| | | 146 | | |
| | | 147 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAt = -1) |
| | 0 | 148 | | { |
| | 0 | 149 | | insertAt = insertAt < 0 ? rowCount : insertAt; |
| | | 150 | | |
| | 0 | 151 | | Array.Resize(ref allRowNames, rowCount + 1); |
| | 0 | 152 | | for (int i = rowCount; i > insertAt; i--) |
| | 0 | 153 | | { |
| | 0 | 154 | | allRowNames[i] = allRowNames[i - 1]; |
| | 0 | 155 | | } |
| | | 156 | | |
| | 0 | 157 | | string empty = string.Empty; |
| | 0 | 158 | | int rowNamesLength = rowNames?.Length ?? 0; |
| | 0 | 159 | | for (int i = 0; i < rowNames.Length; i++) |
| | 0 | 160 | | { |
| | 0 | 161 | | string nameAt = rowNames[i]; |
| | 0 | 162 | | allRowNames[insertAt + i] = nameAt ?? empty; |
| | 0 | 163 | | } |
| | | 164 | | |
| | 0 | 165 | | for (int i = rowNamesLength; i < numberOfNewRows; i++) |
| | 0 | 166 | | { |
| | 0 | 167 | | allRowNames[insertAt + i] = empty; |
| | 0 | 168 | | } |
| | | 169 | | |
| | 0 | 170 | | InsertRowsOfTypeInternal(ref allStringColumns, insertAt, numberOfNewRows); |
| | 0 | 171 | | InsertRowsOfTypeInternal(ref allBoolColumns, insertAt, numberOfNewRows); |
| | 0 | 172 | | InsertRowsOfTypeInternal(ref allCharColumns, insertAt, numberOfNewRows); |
| | 0 | 173 | | InsertRowsOfTypeInternal(ref allSbyteColumns, insertAt, numberOfNewRows); |
| | 0 | 174 | | InsertRowsOfTypeInternal(ref allByteColumns, insertAt, numberOfNewRows); |
| | 0 | 175 | | InsertRowsOfTypeInternal(ref allShortColumns, insertAt, numberOfNewRows); |
| | 0 | 176 | | InsertRowsOfTypeInternal(ref allUshortColumns, insertAt, numberOfNewRows); |
| | 0 | 177 | | InsertRowsOfTypeInternal(ref allIntColumns, insertAt, numberOfNewRows); |
| | 0 | 178 | | InsertRowsOfTypeInternal(ref allUintColumns, insertAt, numberOfNewRows); |
| | 0 | 179 | | InsertRowsOfTypeInternal(ref allLongColumns, insertAt, numberOfNewRows); |
| | 0 | 180 | | InsertRowsOfTypeInternal(ref allUlongColumns, insertAt, numberOfNewRows); |
| | 0 | 181 | | InsertRowsOfTypeInternal(ref allFloatColumns, insertAt, numberOfNewRows); |
| | 0 | 182 | | InsertRowsOfTypeInternal(ref allDoubleColumns, insertAt, numberOfNewRows); |
| | 0 | 183 | | InsertRowsOfTypeInternal(ref allVector2Columns, insertAt, numberOfNewRows); |
| | 0 | 184 | | InsertRowsOfTypeInternal(ref allVector3Columns, insertAt, numberOfNewRows); |
| | 0 | 185 | | InsertRowsOfTypeInternal(ref allVector4Columns, insertAt, numberOfNewRows); |
| | 0 | 186 | | InsertRowsOfTypeInternal(ref allVector2IntColumns, insertAt, numberOfNewRows); |
| | 0 | 187 | | InsertRowsOfTypeInternal(ref allVector3IntColumns, insertAt, numberOfNewRows); |
| | 0 | 188 | | InsertRowsOfTypeInternal(ref allQuaternionColumns, insertAt, numberOfNewRows); |
| | 0 | 189 | | InsertRowsOfTypeInternal(ref allRectColumns, insertAt, numberOfNewRows); |
| | 0 | 190 | | InsertRowsOfTypeInternal(ref allRectIntColumns, insertAt, numberOfNewRows); |
| | 0 | 191 | | InsertRowsOfTypeInternal(ref allColorColumns, insertAt, numberOfNewRows); |
| | 0 | 192 | | InsertRowsOfTypeInternal(ref allLayerMaskColumns, insertAt, numberOfNewRows); |
| | 0 | 193 | | InsertRowsOfTypeInternal(ref allBoundsColumns, insertAt, numberOfNewRows); |
| | 0 | 194 | | InsertRowsOfTypeInternal(ref allBoundsIntColumns, insertAt, numberOfNewRows); |
| | 0 | 195 | | InsertRowsOfTypeInternal(ref allHash128Columns, insertAt, numberOfNewRows); |
| | 0 | 196 | | InsertRowsOfTypeInternal(ref allGradientColumns, insertAt, numberOfNewRows); |
| | 0 | 197 | | InsertRowsOfTypeInternal(ref allAnimationCurveColumns, insertAt, numberOfNewRows); |
| | 0 | 198 | | InsertRowsOfTypeInternal(ref allObjectRefColumns, insertAt, numberOfNewRows); |
| | | 199 | | |
| | 0 | 200 | | rowCount += numberOfNewRows; |
| | 0 | 201 | | } |
| | | 202 | | |
| | | 203 | | public void RemoveRow(int removeAt) |
| | 0 | 204 | | { |
| | 0 | 205 | | int newRowCount = rowCount - 1; |
| | 0 | 206 | | for (int j = removeAt; j < newRowCount; j++) |
| | 0 | 207 | | { |
| | 0 | 208 | | allRowNames[j] = allRowNames[j + 1]; |
| | 0 | 209 | | } |
| | | 210 | | |
| | 0 | 211 | | Array.Resize(ref allRowNames, newRowCount); |
| | | 212 | | |
| | 0 | 213 | | DeleteRowsOfTypeInternal(ref allStringColumns, removeAt, 1); |
| | 0 | 214 | | DeleteRowsOfTypeInternal(ref allBoolColumns, removeAt, 1); |
| | 0 | 215 | | DeleteRowsOfTypeInternal(ref allCharColumns, removeAt, 1); |
| | 0 | 216 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, removeAt, 1); |
| | 0 | 217 | | DeleteRowsOfTypeInternal(ref allByteColumns, removeAt, 1); |
| | 0 | 218 | | DeleteRowsOfTypeInternal(ref allShortColumns, removeAt, 1); |
| | 0 | 219 | | DeleteRowsOfTypeInternal(ref allUshortColumns, removeAt, 1); |
| | 0 | 220 | | DeleteRowsOfTypeInternal(ref allIntColumns, removeAt, 1); |
| | 0 | 221 | | DeleteRowsOfTypeInternal(ref allUintColumns, removeAt, 1); |
| | 0 | 222 | | DeleteRowsOfTypeInternal(ref allLongColumns, removeAt, 1); |
| | 0 | 223 | | DeleteRowsOfTypeInternal(ref allUlongColumns, removeAt, 1); |
| | 0 | 224 | | DeleteRowsOfTypeInternal(ref allFloatColumns, removeAt, 1); |
| | 0 | 225 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, removeAt, 1); |
| | 0 | 226 | | DeleteRowsOfTypeInternal(ref allVector2Columns, removeAt, 1); |
| | 0 | 227 | | DeleteRowsOfTypeInternal(ref allVector3Columns, removeAt, 1); |
| | 0 | 228 | | DeleteRowsOfTypeInternal(ref allVector4Columns, removeAt, 1); |
| | 0 | 229 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, removeAt, 1); |
| | 0 | 230 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, removeAt, 1); |
| | 0 | 231 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, removeAt, 1); |
| | 0 | 232 | | DeleteRowsOfTypeInternal(ref allRectColumns, removeAt, 1); |
| | 0 | 233 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, removeAt, 1); |
| | 0 | 234 | | DeleteRowsOfTypeInternal(ref allColorColumns, removeAt, 1); |
| | 0 | 235 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, removeAt, 1); |
| | 0 | 236 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, removeAt, 1); |
| | 0 | 237 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, removeAt, 1); |
| | 0 | 238 | | DeleteRowsOfTypeInternal(ref allHash128Columns, removeAt, 1); |
| | 0 | 239 | | DeleteRowsOfTypeInternal(ref allGradientColumns, removeAt, 1); |
| | 0 | 240 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, removeAt, 1); |
| | 0 | 241 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, removeAt, 1); |
| | | 242 | | |
| | 0 | 243 | | --rowCount; |
| | 0 | 244 | | } |
| | | 245 | | |
| | | 246 | | public void RemoveRows(int removeAt, int numberOfRowsToDelete) |
| | 0 | 247 | | { |
| | 0 | 248 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | 0 | 249 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 250 | | { |
| | 0 | 251 | | allRowNames[j] = allRowNames[j + numberOfRowsToDelete]; |
| | 0 | 252 | | } |
| | | 253 | | |
| | 0 | 254 | | Array.Resize(ref allRowNames, newRowCount); |
| | | 255 | | |
| | 0 | 256 | | DeleteRowsOfTypeInternal(ref allStringColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 257 | | DeleteRowsOfTypeInternal(ref allBoolColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 258 | | DeleteRowsOfTypeInternal(ref allCharColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 259 | | DeleteRowsOfTypeInternal(ref allSbyteColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 260 | | DeleteRowsOfTypeInternal(ref allByteColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 261 | | DeleteRowsOfTypeInternal(ref allShortColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 262 | | DeleteRowsOfTypeInternal(ref allUshortColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 263 | | DeleteRowsOfTypeInternal(ref allIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 264 | | DeleteRowsOfTypeInternal(ref allUintColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 265 | | DeleteRowsOfTypeInternal(ref allLongColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 266 | | DeleteRowsOfTypeInternal(ref allUlongColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 267 | | DeleteRowsOfTypeInternal(ref allFloatColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 268 | | DeleteRowsOfTypeInternal(ref allDoubleColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 269 | | DeleteRowsOfTypeInternal(ref allVector2Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 270 | | DeleteRowsOfTypeInternal(ref allVector3Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 271 | | DeleteRowsOfTypeInternal(ref allVector4Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 272 | | DeleteRowsOfTypeInternal(ref allVector2IntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 273 | | DeleteRowsOfTypeInternal(ref allVector3IntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 274 | | DeleteRowsOfTypeInternal(ref allQuaternionColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 275 | | DeleteRowsOfTypeInternal(ref allRectColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 276 | | DeleteRowsOfTypeInternal(ref allRectIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 277 | | DeleteRowsOfTypeInternal(ref allColorColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 278 | | DeleteRowsOfTypeInternal(ref allLayerMaskColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 279 | | DeleteRowsOfTypeInternal(ref allBoundsColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 280 | | DeleteRowsOfTypeInternal(ref allBoundsIntColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 281 | | DeleteRowsOfTypeInternal(ref allHash128Columns, removeAt, numberOfRowsToDelete); |
| | 0 | 282 | | DeleteRowsOfTypeInternal(ref allGradientColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 283 | | DeleteRowsOfTypeInternal(ref allAnimationCurveColumns, removeAt, numberOfRowsToDelete); |
| | 0 | 284 | | DeleteRowsOfTypeInternal(ref allObjectRefColumns, removeAt, numberOfRowsToDelete); |
| | | 285 | | |
| | 0 | 286 | | rowCount -= numberOfRowsToDelete; |
| | 0 | 287 | | } |
| | | 288 | | |
| | | 289 | | // Add Column |
| | | 290 | | |
| | | 291 | | public int AddStringColumn(string columnName, int insertAt = -1) |
| | 0 | 292 | | { |
| | 0 | 293 | | return AddColumnInternal(columnName, ref allStringColumns, ColumnType.String, insertAt); |
| | 0 | 294 | | } |
| | | 295 | | |
| | | 296 | | public int AddBoolColumn(string columnName, int insertAt = -1) |
| | 0 | 297 | | { |
| | 0 | 298 | | return AddColumnInternal(columnName, ref allBoolColumns, ColumnType.Bool, insertAt); |
| | 0 | 299 | | } |
| | | 300 | | |
| | | 301 | | public int AddCharColumn(string columnName, int insertAt = -1) |
| | 0 | 302 | | { |
| | 0 | 303 | | return AddColumnInternal(columnName, ref allCharColumns, ColumnType.Char, insertAt); |
| | 0 | 304 | | } |
| | | 305 | | |
| | | 306 | | public int AddSbyteColumn(string columnName, int insertAt = -1) |
| | 0 | 307 | | { |
| | 0 | 308 | | return AddColumnInternal(columnName, ref allSbyteColumns, ColumnType.Sbyte, insertAt); |
| | 0 | 309 | | } |
| | | 310 | | |
| | | 311 | | public int AddByteColumn(string columnName, int insertAt = -1) |
| | 0 | 312 | | { |
| | 0 | 313 | | return AddColumnInternal(columnName, ref allByteColumns, ColumnType.Byte, insertAt); |
| | 0 | 314 | | } |
| | | 315 | | |
| | | 316 | | public int AddShortColumn(string columnName, int insertAt = -1) |
| | 0 | 317 | | { |
| | 0 | 318 | | return AddColumnInternal(columnName, ref allShortColumns, ColumnType.Short, insertAt); |
| | 0 | 319 | | } |
| | | 320 | | |
| | | 321 | | public int AddUshortColumn(string columnName, int insertAt = -1) |
| | 0 | 322 | | { |
| | 0 | 323 | | return AddColumnInternal(columnName, ref allUshortColumns, ColumnType.Ushort, insertAt); |
| | 0 | 324 | | } |
| | | 325 | | |
| | | 326 | | public int AddIntColumn(string columnName, int insertAt = -1) |
| | 0 | 327 | | { |
| | 0 | 328 | | return AddColumnInternal(columnName, ref allIntColumns, ColumnType.Int, insertAt); |
| | 0 | 329 | | } |
| | | 330 | | |
| | | 331 | | public int AddUintColumn(string columnName, int insertAt = -1) |
| | 0 | 332 | | { |
| | 0 | 333 | | return AddColumnInternal(columnName, ref allUintColumns, ColumnType.Uint, insertAt); |
| | 0 | 334 | | } |
| | | 335 | | |
| | | 336 | | public int AddLongColumn(string columnName, int insertAt = -1) |
| | 0 | 337 | | { |
| | 0 | 338 | | return AddColumnInternal(columnName, ref allLongColumns, ColumnType.Long, insertAt); |
| | 0 | 339 | | } |
| | | 340 | | |
| | | 341 | | public int AddUlongColumn(string columnName, int insertAt = -1) |
| | 0 | 342 | | { |
| | 0 | 343 | | return AddColumnInternal(columnName, ref allUlongColumns, ColumnType.Ulong, insertAt); |
| | 0 | 344 | | } |
| | | 345 | | |
| | | 346 | | public int AddFloatColumn(string columnName, int insertAt = -1) |
| | 0 | 347 | | { |
| | 0 | 348 | | return AddColumnInternal(columnName, ref allFloatColumns, ColumnType.Float, insertAt); |
| | 0 | 349 | | } |
| | | 350 | | |
| | | 351 | | public int AddDoubleColumn(string columnName, int insertAt = -1) |
| | 0 | 352 | | { |
| | 0 | 353 | | return AddColumnInternal(columnName, ref allDoubleColumns, ColumnType.Double, insertAt); |
| | 0 | 354 | | } |
| | | 355 | | |
| | | 356 | | public int AddVector2Column(string columnName, int insertAt = -1) |
| | 0 | 357 | | { |
| | 0 | 358 | | return AddColumnInternal(columnName, ref allVector2Columns, ColumnType.Vector2, insertAt); |
| | 0 | 359 | | } |
| | | 360 | | |
| | | 361 | | public int AddVector3Column(string columnName, int insertAt = -1) |
| | 0 | 362 | | { |
| | 0 | 363 | | return AddColumnInternal(columnName, ref allVector3Columns, ColumnType.Vector3, insertAt); |
| | 0 | 364 | | } |
| | | 365 | | |
| | | 366 | | public int AddVector4Column(string columnName, int insertAt = -1) |
| | 0 | 367 | | { |
| | 0 | 368 | | return AddColumnInternal(columnName, ref allVector4Columns, ColumnType.Vector4, insertAt); |
| | 0 | 369 | | } |
| | | 370 | | |
| | | 371 | | public int AddVector2IntColumn(string columnName, int insertAt = -1) |
| | 0 | 372 | | { |
| | 0 | 373 | | return AddColumnInternal(columnName, ref allVector2IntColumns, ColumnType.Vector2Int, insertAt); |
| | 0 | 374 | | } |
| | | 375 | | |
| | | 376 | | public int AddVector3IntColumn(string columnName, int insertAt = -1) |
| | 0 | 377 | | { |
| | 0 | 378 | | return AddColumnInternal(columnName, ref allVector3IntColumns, ColumnType.Vector3Int, insertAt); |
| | 0 | 379 | | } |
| | | 380 | | |
| | | 381 | | public int AddQuaternionColumn(string columnName, int insertAt = -1) |
| | 0 | 382 | | { |
| | 0 | 383 | | return AddColumnInternal(columnName, ref allQuaternionColumns, ColumnType.Quaternion, insertAt); |
| | 0 | 384 | | } |
| | | 385 | | |
| | | 386 | | public int AddRectColumn(string columnName, int insertAt = -1) |
| | 0 | 387 | | { |
| | 0 | 388 | | return AddColumnInternal(columnName, ref allRectColumns, ColumnType.Rect, insertAt); |
| | 0 | 389 | | } |
| | | 390 | | |
| | | 391 | | public int AddRectIntColumn(string columnName, int insertAt = -1) |
| | 0 | 392 | | { |
| | 0 | 393 | | return AddColumnInternal(columnName, ref allRectIntColumns, ColumnType.RectInt, insertAt); |
| | 0 | 394 | | } |
| | | 395 | | |
| | | 396 | | public int AddColorColumn(string columnName, int insertAt = -1) |
| | 0 | 397 | | { |
| | 0 | 398 | | return AddColumnInternal(columnName, ref allColorColumns, ColumnType.Color, insertAt); |
| | 0 | 399 | | } |
| | | 400 | | |
| | | 401 | | public int AddLayerMaskColumn(string columnName, int insertAt = -1) |
| | 0 | 402 | | { |
| | 0 | 403 | | return AddColumnInternal(columnName, ref allLayerMaskColumns, ColumnType.LayerMask, insertAt); |
| | 0 | 404 | | } |
| | | 405 | | |
| | | 406 | | public int AddBoundsColumn(string columnName, int insertAt = -1) |
| | 0 | 407 | | { |
| | 0 | 408 | | return AddColumnInternal(columnName, ref allBoundsColumns, ColumnType.Bounds, insertAt); |
| | 0 | 409 | | } |
| | | 410 | | |
| | | 411 | | public int AddBoundsIntColumn(string columnName, int insertAt = -1) |
| | 0 | 412 | | { |
| | 0 | 413 | | return AddColumnInternal(columnName, ref allBoundsIntColumns, ColumnType.BoundsInt, insertAt); |
| | 0 | 414 | | } |
| | | 415 | | |
| | | 416 | | public int AddHash128Column(string columnName, int insertAt = -1) |
| | 0 | 417 | | { |
| | 0 | 418 | | return AddColumnInternal(columnName, ref allHash128Columns, ColumnType.Hash128, insertAt); |
| | 0 | 419 | | } |
| | | 420 | | |
| | | 421 | | public int AddGradientColumn(string columnName, int insertAt = -1) |
| | 0 | 422 | | { |
| | 0 | 423 | | return AddColumnInternal(columnName, ref allGradientColumns, ColumnType.Gradient, insertAt); |
| | 0 | 424 | | } |
| | | 425 | | |
| | | 426 | | public int AddAnimationCurveColumn(string columnName, int insertAt = -1) |
| | 0 | 427 | | { |
| | 0 | 428 | | return AddColumnInternal(columnName, ref allAnimationCurveColumns, ColumnType.AnimationCurve, insertAt); |
| | 0 | 429 | | } |
| | | 430 | | |
| | | 431 | | public int AddObjectColumn(string columnName, int insertAt = -1) |
| | 0 | 432 | | { |
| | 0 | 433 | | return AddColumnInternal(columnName, ref allObjectRefColumns, ColumnType.Object, insertAt); |
| | 0 | 434 | | } |
| | | 435 | | |
| | | 436 | | // Remove Column |
| | | 437 | | |
| | | 438 | | public void RemoveStringColumn(int removeAt) |
| | 0 | 439 | | { |
| | 0 | 440 | | RemoveColumnInternal(ref allStringColumns, ColumnType.String, removeAt); |
| | 0 | 441 | | } |
| | | 442 | | |
| | | 443 | | public void RemoveBoolColumn(int removeAt) |
| | 0 | 444 | | { |
| | 0 | 445 | | RemoveColumnInternal(ref allBoolColumns, ColumnType.Bool, removeAt); |
| | 0 | 446 | | } |
| | | 447 | | |
| | | 448 | | public void RemoveCharColumn(int removeAt) |
| | 0 | 449 | | { |
| | 0 | 450 | | RemoveColumnInternal(ref allCharColumns, ColumnType.Char, removeAt); |
| | 0 | 451 | | } |
| | | 452 | | |
| | | 453 | | public void RemoveSbyteColumn(int removeAt) |
| | 0 | 454 | | { |
| | 0 | 455 | | RemoveColumnInternal(ref allSbyteColumns, ColumnType.Sbyte, removeAt); |
| | 0 | 456 | | } |
| | | 457 | | |
| | | 458 | | public void RemoveByteColumn(int removeAt) |
| | 0 | 459 | | { |
| | 0 | 460 | | RemoveColumnInternal(ref allByteColumns, ColumnType.Byte, removeAt); |
| | 0 | 461 | | } |
| | | 462 | | |
| | | 463 | | public void RemoveShortColumn(int removeAt) |
| | 0 | 464 | | { |
| | 0 | 465 | | RemoveColumnInternal(ref allShortColumns, ColumnType.Short, removeAt); |
| | 0 | 466 | | } |
| | | 467 | | |
| | | 468 | | public void RemoveUshortColumn(int removeAt) |
| | 0 | 469 | | { |
| | 0 | 470 | | RemoveColumnInternal(ref allUshortColumns, ColumnType.Ushort, removeAt); |
| | 0 | 471 | | } |
| | | 472 | | |
| | | 473 | | public void RemoveIntColumn(int removeAt) |
| | 0 | 474 | | { |
| | 0 | 475 | | RemoveColumnInternal(ref allIntColumns, ColumnType.Int, removeAt); |
| | 0 | 476 | | } |
| | | 477 | | |
| | | 478 | | public void RemoveUintColumn(int removeAt) |
| | 0 | 479 | | { |
| | 0 | 480 | | RemoveColumnInternal(ref allUintColumns, ColumnType.Uint, removeAt); |
| | 0 | 481 | | } |
| | | 482 | | |
| | | 483 | | public void RemoveLongColumn(int removeAt) |
| | 0 | 484 | | { |
| | 0 | 485 | | RemoveColumnInternal(ref allLongColumns, ColumnType.Long, removeAt); |
| | 0 | 486 | | } |
| | | 487 | | |
| | | 488 | | public void RemoveUlongColumn(int removeAt) |
| | 0 | 489 | | { |
| | 0 | 490 | | RemoveColumnInternal(ref allUlongColumns, ColumnType.Ulong, removeAt); |
| | 0 | 491 | | } |
| | | 492 | | |
| | | 493 | | public void RemoveFloatColumn(int removeAt) |
| | 0 | 494 | | { |
| | 0 | 495 | | RemoveColumnInternal(ref allFloatColumns, ColumnType.Float, removeAt); |
| | 0 | 496 | | } |
| | | 497 | | |
| | | 498 | | public void RemoveDoubleColumn(int removeAt) |
| | 0 | 499 | | { |
| | 0 | 500 | | RemoveColumnInternal(ref allDoubleColumns, ColumnType.Double, removeAt); |
| | 0 | 501 | | } |
| | | 502 | | |
| | | 503 | | public void RemoveVector2Column(int removeAt) |
| | 0 | 504 | | { |
| | 0 | 505 | | RemoveColumnInternal(ref allVector2Columns, ColumnType.Vector2, removeAt); |
| | 0 | 506 | | } |
| | | 507 | | |
| | | 508 | | public void RemoveVector3Column(int removeAt) |
| | 0 | 509 | | { |
| | 0 | 510 | | RemoveColumnInternal(ref allVector3Columns, ColumnType.Vector3, removeAt); |
| | 0 | 511 | | } |
| | | 512 | | |
| | | 513 | | public void RemoveVector4Column(int removeAt) |
| | 0 | 514 | | { |
| | 0 | 515 | | RemoveColumnInternal(ref allVector4Columns, ColumnType.Vector4, removeAt); |
| | 0 | 516 | | } |
| | | 517 | | |
| | | 518 | | public void RemoveVector2IntColumn(int removeAt) |
| | 0 | 519 | | { |
| | 0 | 520 | | RemoveColumnInternal(ref allVector2IntColumns, ColumnType.Vector2Int, removeAt); |
| | 0 | 521 | | } |
| | | 522 | | |
| | | 523 | | public void RemoveVector3IntColumn(int removeAt) |
| | 0 | 524 | | { |
| | 0 | 525 | | RemoveColumnInternal(ref allVector3IntColumns, ColumnType.Vector3Int, removeAt); |
| | 0 | 526 | | } |
| | | 527 | | |
| | | 528 | | public void RemoveQuaternionColumn(int removeAt) |
| | 0 | 529 | | { |
| | 0 | 530 | | RemoveColumnInternal(ref allQuaternionColumns, ColumnType.Quaternion, removeAt); |
| | 0 | 531 | | } |
| | | 532 | | |
| | | 533 | | public void RemoveRectColumn(int removeAt) |
| | 0 | 534 | | { |
| | 0 | 535 | | RemoveColumnInternal(ref allRectColumns, ColumnType.Rect, removeAt); |
| | 0 | 536 | | } |
| | | 537 | | |
| | | 538 | | public void RemoveRectIntColumn(int removeAt) |
| | 0 | 539 | | { |
| | 0 | 540 | | RemoveColumnInternal(ref allRectIntColumns, ColumnType.RectInt, removeAt); |
| | 0 | 541 | | } |
| | | 542 | | |
| | | 543 | | public void RemoveColorColumn(int removeAt) |
| | 0 | 544 | | { |
| | 0 | 545 | | RemoveColumnInternal(ref allColorColumns, ColumnType.Color, removeAt); |
| | 0 | 546 | | } |
| | | 547 | | |
| | | 548 | | public void RemoveLayerMaskColumn(int removeAt) |
| | 0 | 549 | | { |
| | 0 | 550 | | RemoveColumnInternal(ref allLayerMaskColumns, ColumnType.LayerMask, removeAt); |
| | 0 | 551 | | } |
| | | 552 | | |
| | | 553 | | public void RemoveBoundsColumn(int removeAt) |
| | 0 | 554 | | { |
| | 0 | 555 | | RemoveColumnInternal(ref allBoundsColumns, ColumnType.Bounds, removeAt); |
| | 0 | 556 | | } |
| | | 557 | | |
| | | 558 | | public void RemoveBoundsIntColumn(int removeAt) |
| | 0 | 559 | | { |
| | 0 | 560 | | RemoveColumnInternal(ref allBoundsIntColumns, ColumnType.BoundsInt, removeAt); |
| | 0 | 561 | | } |
| | | 562 | | |
| | | 563 | | public void RemoveHash128Column(int removeAt) |
| | 0 | 564 | | { |
| | 0 | 565 | | RemoveColumnInternal(ref allHash128Columns, ColumnType.Hash128, removeAt); |
| | 0 | 566 | | } |
| | | 567 | | |
| | | 568 | | public void RemoveGradientColumn(int removeAt) |
| | 0 | 569 | | { |
| | 0 | 570 | | RemoveColumnInternal(ref allGradientColumns, ColumnType.Gradient, removeAt); |
| | 0 | 571 | | } |
| | | 572 | | |
| | | 573 | | public void RemoveAnimationCurveColumn(int removeAt) |
| | 0 | 574 | | { |
| | 0 | 575 | | RemoveColumnInternal(ref allAnimationCurveColumns, ColumnType.AnimationCurve, removeAt); |
| | 0 | 576 | | } |
| | | 577 | | |
| | | 578 | | public void RemoveObjectColumn(int removeAt) |
| | 0 | 579 | | { |
| | 0 | 580 | | RemoveColumnInternal(ref allObjectRefColumns, ColumnType.Object, removeAt); |
| | 0 | 581 | | } |
| | | 582 | | |
| | | 583 | | // Set |
| | | 584 | | |
| | | 585 | | public void SetString(int row, int columnID, string value) |
| | 0 | 586 | | { |
| | 0 | 587 | | SetCell(row, columnID, ref allStringColumns, value); |
| | 0 | 588 | | } |
| | | 589 | | |
| | | 590 | | public void SetBool(int row, int columnID, bool value) |
| | 0 | 591 | | { |
| | 0 | 592 | | SetCell(row, columnID, ref allBoolColumns, value); |
| | 0 | 593 | | } |
| | | 594 | | |
| | | 595 | | public void SetChar(int row, int columnID, char value) |
| | 0 | 596 | | { |
| | 0 | 597 | | SetCell(row, columnID, ref allCharColumns, value); |
| | 0 | 598 | | } |
| | | 599 | | |
| | | 600 | | public void SetSbyte(int row, int columnID, sbyte value) |
| | 0 | 601 | | { |
| | 0 | 602 | | SetCell(row, columnID, ref allSbyteColumns, value); |
| | 0 | 603 | | } |
| | | 604 | | |
| | | 605 | | public void SetByte(int row, int columnID, byte value) |
| | 0 | 606 | | { |
| | 0 | 607 | | SetCell(row, columnID, ref allByteColumns, value); |
| | 0 | 608 | | } |
| | | 609 | | |
| | | 610 | | public void SetShort(int row, int columnID, short value) |
| | 0 | 611 | | { |
| | 0 | 612 | | SetCell(row, columnID, ref allShortColumns, value); |
| | 0 | 613 | | } |
| | | 614 | | |
| | | 615 | | public void SetUshort(int row, int columnID, ushort value) |
| | 0 | 616 | | { |
| | 0 | 617 | | SetCell(row, columnID, ref allUshortColumns, value); |
| | 0 | 618 | | } |
| | | 619 | | |
| | | 620 | | public void SetInt(int row, int columnID, int value) |
| | 0 | 621 | | { |
| | 0 | 622 | | SetCell(row, columnID, ref allIntColumns, value); |
| | 0 | 623 | | } |
| | | 624 | | |
| | | 625 | | public void SetUint(int row, int columnID, uint value) |
| | 0 | 626 | | { |
| | 0 | 627 | | SetCell(row, columnID, ref allUintColumns, value); |
| | 0 | 628 | | } |
| | | 629 | | |
| | | 630 | | public void SetLong(int row, int columnID, long value) |
| | 0 | 631 | | { |
| | 0 | 632 | | SetCell(row, columnID, ref allLongColumns, value); |
| | 0 | 633 | | } |
| | | 634 | | |
| | | 635 | | public void SetUlong(int row, int columnID, ulong value) |
| | 0 | 636 | | { |
| | 0 | 637 | | SetCell(row, columnID, ref allUlongColumns, value); |
| | 0 | 638 | | } |
| | | 639 | | |
| | | 640 | | public void SetFloat(int row, int columnID, float value) |
| | 0 | 641 | | { |
| | 0 | 642 | | SetCell(row, columnID, ref allFloatColumns, value); |
| | 0 | 643 | | } |
| | | 644 | | |
| | | 645 | | public void SetDouble(int row, int columnID, double value) |
| | 0 | 646 | | { |
| | 0 | 647 | | SetCell(row, columnID, ref allDoubleColumns, value); |
| | 0 | 648 | | } |
| | | 649 | | |
| | | 650 | | public void SetVector2(int row, int columnID, Vector2 value) |
| | 0 | 651 | | { |
| | 0 | 652 | | SetCell(row, columnID, ref allVector2Columns, value); |
| | 0 | 653 | | } |
| | | 654 | | |
| | | 655 | | public void SetVector3(int row, int columnID, Vector3 value) |
| | 0 | 656 | | { |
| | 0 | 657 | | SetCell(row, columnID, ref allVector3Columns, value); |
| | 0 | 658 | | } |
| | | 659 | | |
| | | 660 | | public void SetVector4(int row, int columnID, Vector4 value) |
| | 0 | 661 | | { |
| | 0 | 662 | | SetCell(row, columnID, ref allVector4Columns, value); |
| | 0 | 663 | | } |
| | | 664 | | |
| | | 665 | | public void SetVector2Int(int row, int columnID, Vector2Int value) |
| | 0 | 666 | | { |
| | 0 | 667 | | SetCell(row, columnID, ref allVector2IntColumns, value); |
| | 0 | 668 | | } |
| | | 669 | | |
| | | 670 | | public void SetVector3Int(int row, int columnID, Vector3Int value) |
| | 0 | 671 | | { |
| | 0 | 672 | | SetCell(row, columnID, ref allVector3IntColumns, value); |
| | 0 | 673 | | } |
| | | 674 | | |
| | | 675 | | public void SetQuaternion(int row, int columnID, Quaternion value) |
| | 0 | 676 | | { |
| | 0 | 677 | | SetCell(row, columnID, ref allQuaternionColumns, value); |
| | 0 | 678 | | } |
| | | 679 | | |
| | | 680 | | public void SetRect(int row, int columnID, Rect value) |
| | 0 | 681 | | { |
| | 0 | 682 | | SetCell(row, columnID, ref allRectColumns, value); |
| | 0 | 683 | | } |
| | | 684 | | |
| | | 685 | | public void SetRectInt(int row, int columnID, RectInt value) |
| | 0 | 686 | | { |
| | 0 | 687 | | SetCell(row, columnID, ref allRectIntColumns, value); |
| | 0 | 688 | | } |
| | | 689 | | |
| | | 690 | | public void SetColor(int row, int columnID, Color value) |
| | 0 | 691 | | { |
| | 0 | 692 | | SetCell(row, columnID, ref allColorColumns, value); |
| | 0 | 693 | | } |
| | | 694 | | |
| | | 695 | | public void SetLayerMask(int row, int columnID, LayerMask value) |
| | 0 | 696 | | { |
| | 0 | 697 | | SetCell(row, columnID, ref allLayerMaskColumns, value); |
| | 0 | 698 | | } |
| | | 699 | | |
| | | 700 | | public void SetBounds(int row, int columnID, Bounds value) |
| | 0 | 701 | | { |
| | 0 | 702 | | SetCell(row, columnID, ref allBoundsColumns, value); |
| | 0 | 703 | | } |
| | | 704 | | |
| | | 705 | | public void SetBoundsInt(int row, int columnID, BoundsInt value) |
| | 0 | 706 | | { |
| | 0 | 707 | | SetCell(row, columnID, ref allBoundsIntColumns, value); |
| | 0 | 708 | | } |
| | | 709 | | |
| | | 710 | | public void SetHash128(int row, int columnID, Hash128 value) |
| | 0 | 711 | | { |
| | 0 | 712 | | SetCell(row, columnID, ref allHash128Columns, value); |
| | 0 | 713 | | } |
| | | 714 | | |
| | | 715 | | public void SetGradient(int row, int columnID, Gradient value) |
| | 0 | 716 | | { |
| | 0 | 717 | | SetCell(row, columnID, ref allGradientColumns, value); |
| | 0 | 718 | | } |
| | | 719 | | |
| | | 720 | | public void SetAnimationCurve(int row, int columnID, AnimationCurve value) |
| | 0 | 721 | | { |
| | 0 | 722 | | SetCell(row, columnID, ref allAnimationCurveColumns, value); |
| | 0 | 723 | | } |
| | | 724 | | |
| | | 725 | | public void SetObject(int row, int columnID, UnityEngine.Object value) |
| | 0 | 726 | | { |
| | 0 | 727 | | SetCell(row, columnID, ref allObjectRefColumns, value); |
| | 0 | 728 | | } |
| | | 729 | | |
| | | 730 | | // Get |
| | | 731 | | |
| | | 732 | | public string GetString(int row, int columnID) |
| | 0 | 733 | | { |
| | 0 | 734 | | return GetCell(row, columnID, ref allStringColumns); |
| | 0 | 735 | | } |
| | | 736 | | |
| | | 737 | | public bool GetBool(int row, int columnID) |
| | 0 | 738 | | { |
| | 0 | 739 | | return GetCell(row, columnID, ref allBoolColumns); |
| | 0 | 740 | | } |
| | | 741 | | |
| | | 742 | | public char GetChar(int row, int columnID) |
| | 0 | 743 | | { |
| | 0 | 744 | | return GetCell(row, columnID, ref allCharColumns); |
| | 0 | 745 | | } |
| | | 746 | | |
| | | 747 | | public sbyte GetSbyte(int row, int columnID) |
| | 0 | 748 | | { |
| | 0 | 749 | | return GetCell(row, columnID, ref allSbyteColumns); |
| | 0 | 750 | | } |
| | | 751 | | |
| | | 752 | | public byte GetByte(int row, int columnID) |
| | 0 | 753 | | { |
| | 0 | 754 | | return GetCell(row, columnID, ref allByteColumns); |
| | 0 | 755 | | } |
| | | 756 | | |
| | | 757 | | public short GetShort(int row, int columnID) |
| | 0 | 758 | | { |
| | 0 | 759 | | return GetCell(row, columnID, ref allShortColumns); |
| | 0 | 760 | | } |
| | | 761 | | |
| | | 762 | | public ushort GetUshort(int row, int columnID) |
| | 0 | 763 | | { |
| | 0 | 764 | | return GetCell(row, columnID, ref allUshortColumns); |
| | 0 | 765 | | } |
| | | 766 | | |
| | | 767 | | public int GetInt(int row, int columnID) |
| | 0 | 768 | | { |
| | 0 | 769 | | return GetCell(row, columnID, ref allIntColumns); |
| | 0 | 770 | | } |
| | | 771 | | |
| | | 772 | | public uint GetUint(int row, int columnID) |
| | 0 | 773 | | { |
| | 0 | 774 | | return GetCell(row, columnID, ref allUintColumns); |
| | 0 | 775 | | } |
| | | 776 | | |
| | | 777 | | public long GetLong(int row, int columnID) |
| | 0 | 778 | | { |
| | 0 | 779 | | return GetCell(row, columnID, ref allLongColumns); |
| | 0 | 780 | | } |
| | | 781 | | |
| | | 782 | | public ulong GetUlong(int row, int columnID) |
| | 0 | 783 | | { |
| | 0 | 784 | | return GetCell(row, columnID, ref allUlongColumns); |
| | 0 | 785 | | } |
| | | 786 | | |
| | | 787 | | public float GetFloat(int row, int columnID) |
| | 0 | 788 | | { |
| | 0 | 789 | | return GetCell(row, columnID, ref allFloatColumns); |
| | 0 | 790 | | } |
| | | 791 | | |
| | | 792 | | public double GetDouble(int row, int columnID) |
| | 0 | 793 | | { |
| | 0 | 794 | | return GetCell(row, columnID, ref allDoubleColumns); |
| | 0 | 795 | | } |
| | | 796 | | |
| | | 797 | | public Vector2 GetVector2(int row, int columnID) |
| | 0 | 798 | | { |
| | 0 | 799 | | return GetCell(row, columnID, ref allVector2Columns); |
| | 0 | 800 | | } |
| | | 801 | | |
| | | 802 | | public Vector3 GetVector3(int row, int columnID) |
| | 0 | 803 | | { |
| | 0 | 804 | | return GetCell(row, columnID, ref allVector3Columns); |
| | 0 | 805 | | } |
| | | 806 | | |
| | | 807 | | public Vector4 GetVector4(int row, int columnID) |
| | 0 | 808 | | { |
| | 0 | 809 | | return GetCell(row, columnID, ref allVector4Columns); |
| | 0 | 810 | | } |
| | | 811 | | |
| | | 812 | | public Vector2Int GetVector2Int(int row, int columnID) |
| | 0 | 813 | | { |
| | 0 | 814 | | return GetCell(row, columnID, ref allVector2IntColumns); |
| | 0 | 815 | | } |
| | | 816 | | |
| | | 817 | | public Vector3Int GetVector3Int(int row, int columnID) |
| | 0 | 818 | | { |
| | 0 | 819 | | return GetCell(row, columnID, ref allVector3IntColumns); |
| | 0 | 820 | | } |
| | | 821 | | |
| | | 822 | | public Quaternion GetQuaternion(int row, int columnID) |
| | 0 | 823 | | { |
| | 0 | 824 | | return GetCell(row, columnID, ref allQuaternionColumns); |
| | 0 | 825 | | } |
| | | 826 | | |
| | | 827 | | public Rect GetRect(int row, int columnID) |
| | 0 | 828 | | { |
| | 0 | 829 | | return GetCell(row, columnID, ref allRectColumns); |
| | 0 | 830 | | } |
| | | 831 | | |
| | | 832 | | public RectInt GetRectInt(int row, int columnID) |
| | 0 | 833 | | { |
| | 0 | 834 | | return GetCell(row, columnID, ref allRectIntColumns); |
| | 0 | 835 | | } |
| | | 836 | | |
| | | 837 | | public Color GetColor(int row, int columnID) |
| | 0 | 838 | | { |
| | 0 | 839 | | return GetCell(row, columnID, ref allColorColumns); |
| | 0 | 840 | | } |
| | | 841 | | |
| | | 842 | | public LayerMask GetLayerMask(int row, int columnID) |
| | 0 | 843 | | { |
| | 0 | 844 | | return GetCell(row, columnID, ref allLayerMaskColumns); |
| | 0 | 845 | | } |
| | | 846 | | |
| | | 847 | | public Bounds GetBounds(int row, int columnID) |
| | 0 | 848 | | { |
| | 0 | 849 | | return GetCell(row, columnID, ref allBoundsColumns); |
| | 0 | 850 | | } |
| | | 851 | | |
| | | 852 | | public BoundsInt GetBoundsInt(int row, int columnID) |
| | 0 | 853 | | { |
| | 0 | 854 | | return GetCell(row, columnID, ref allBoundsIntColumns); |
| | 0 | 855 | | } |
| | | 856 | | |
| | | 857 | | public Hash128 GetHash128(int row, int columnID) |
| | 0 | 858 | | { |
| | 0 | 859 | | return GetCell(row, columnID, ref allHash128Columns); |
| | 0 | 860 | | } |
| | | 861 | | |
| | | 862 | | public Gradient GetGradient(int row, int columnID) |
| | 0 | 863 | | { |
| | 0 | 864 | | return GetCell(row, columnID, ref allGradientColumns); |
| | 0 | 865 | | } |
| | | 866 | | |
| | | 867 | | public AnimationCurve GetAnimationCurve(int row, int columnID) |
| | 0 | 868 | | { |
| | 0 | 869 | | return GetCell(row, columnID, ref allAnimationCurveColumns); |
| | 0 | 870 | | } |
| | | 871 | | |
| | | 872 | | public UnityEngine.Object GetObject(int row, int columnID) |
| | 0 | 873 | | { |
| | 0 | 874 | | return GetCell(row, columnID, ref allObjectRefColumns); |
| | 0 | 875 | | } |
| | | 876 | | |
| | | 877 | | // Get ref |
| | | 878 | | |
| | | 879 | | public ref string GetStringRef(int row, int columnID) |
| | 0 | 880 | | { |
| | 0 | 881 | | return ref GetCellRef(row, columnID, ref allStringColumns); |
| | 0 | 882 | | } |
| | | 883 | | |
| | | 884 | | public ref bool GetBoolRef(int row, int columnID) |
| | 0 | 885 | | { |
| | 0 | 886 | | return ref GetCellRef(row, columnID, ref allBoolColumns); |
| | 0 | 887 | | } |
| | | 888 | | |
| | | 889 | | public ref char GetCharRef(int row, int columnID) |
| | 0 | 890 | | { |
| | 0 | 891 | | return ref GetCellRef(row, columnID, ref allCharColumns); |
| | 0 | 892 | | } |
| | | 893 | | |
| | | 894 | | public ref sbyte GetSbyteRef(int row, int columnID) |
| | 0 | 895 | | { |
| | 0 | 896 | | return ref GetCellRef(row, columnID, ref allSbyteColumns); |
| | 0 | 897 | | } |
| | | 898 | | |
| | | 899 | | public ref byte GetByteRef(int row, int columnID) |
| | 0 | 900 | | { |
| | 0 | 901 | | return ref GetCellRef(row, columnID, ref allByteColumns); |
| | 0 | 902 | | } |
| | | 903 | | |
| | | 904 | | public ref short GetShortRef(int row, int columnID) |
| | 0 | 905 | | { |
| | 0 | 906 | | return ref GetCellRef(row, columnID, ref allShortColumns); |
| | 0 | 907 | | } |
| | | 908 | | |
| | | 909 | | public ref ushort GetUshortRef(int row, int columnID) |
| | 0 | 910 | | { |
| | 0 | 911 | | return ref GetCellRef(row, columnID, ref allUshortColumns); |
| | 0 | 912 | | } |
| | | 913 | | |
| | | 914 | | public ref int GetIntRef(int row, int columnID) |
| | 0 | 915 | | { |
| | 0 | 916 | | return ref GetCellRef(row, columnID, ref allIntColumns); |
| | 0 | 917 | | } |
| | | 918 | | |
| | | 919 | | public ref uint GetUintRef(int row, int columnID) |
| | 0 | 920 | | { |
| | 0 | 921 | | return ref GetCellRef(row, columnID, ref allUintColumns); |
| | 0 | 922 | | } |
| | | 923 | | |
| | | 924 | | public ref long GetLongRef(int row, int columnID) |
| | 0 | 925 | | { |
| | 0 | 926 | | return ref GetCellRef(row, columnID, ref allLongColumns); |
| | 0 | 927 | | } |
| | | 928 | | |
| | | 929 | | public ref ulong GetUlongRef(int row, int columnID) |
| | 0 | 930 | | { |
| | 0 | 931 | | return ref GetCellRef(row, columnID, ref allUlongColumns); |
| | 0 | 932 | | } |
| | | 933 | | |
| | | 934 | | public ref float GetFloatRef(int row, int columnID) |
| | 0 | 935 | | { |
| | 0 | 936 | | return ref GetCellRef(row, columnID, ref allFloatColumns); |
| | 0 | 937 | | } |
| | | 938 | | |
| | | 939 | | public ref double GetDoubleRef(int row, int columnID) |
| | 0 | 940 | | { |
| | 0 | 941 | | return ref GetCellRef(row, columnID, ref allDoubleColumns); |
| | 0 | 942 | | } |
| | | 943 | | |
| | | 944 | | public ref Vector2 GetVector2Ref(int row, int columnID) |
| | 0 | 945 | | { |
| | 0 | 946 | | return ref GetCellRef(row, columnID, ref allVector2Columns); |
| | 0 | 947 | | } |
| | | 948 | | |
| | | 949 | | public ref Vector3 GetVector3Ref(int row, int columnID) |
| | 0 | 950 | | { |
| | 0 | 951 | | return ref GetCellRef(row, columnID, ref allVector3Columns); |
| | 0 | 952 | | } |
| | | 953 | | |
| | | 954 | | public ref Vector4 GetVector4Ref(int row, int columnID) |
| | 0 | 955 | | { |
| | 0 | 956 | | return ref GetCellRef(row, columnID, ref allVector4Columns); |
| | 0 | 957 | | } |
| | | 958 | | |
| | | 959 | | public ref Vector2Int GetVector2IntRef(int row, int columnID) |
| | 0 | 960 | | { |
| | 0 | 961 | | return ref GetCellRef(row, columnID, ref allVector2IntColumns); |
| | 0 | 962 | | } |
| | | 963 | | |
| | | 964 | | public ref Vector3Int GetVector3IntRef(int row, int columnID) |
| | 0 | 965 | | { |
| | 0 | 966 | | return ref GetCellRef(row, columnID, ref allVector3IntColumns); |
| | 0 | 967 | | } |
| | | 968 | | |
| | | 969 | | public ref Quaternion GetQuaternionRef(int row, int columnID) |
| | 0 | 970 | | { |
| | 0 | 971 | | return ref GetCellRef(row, columnID, ref allQuaternionColumns); |
| | 0 | 972 | | } |
| | | 973 | | |
| | | 974 | | public ref Rect GetRectRef(int row, int columnID) |
| | 0 | 975 | | { |
| | 0 | 976 | | return ref GetCellRef(row, columnID, ref allRectColumns); |
| | 0 | 977 | | } |
| | | 978 | | |
| | | 979 | | public ref RectInt GetRectIntRef(int row, int columnID) |
| | 0 | 980 | | { |
| | 0 | 981 | | return ref GetCellRef(row, columnID, ref allRectIntColumns); |
| | 0 | 982 | | } |
| | | 983 | | |
| | | 984 | | public ref Color GetColorRef(int row, int columnID) |
| | 0 | 985 | | { |
| | 0 | 986 | | return ref GetCellRef(row, columnID, ref allColorColumns); |
| | 0 | 987 | | } |
| | | 988 | | |
| | | 989 | | public ref LayerMask GetLayerMaskRef(int row, int columnID) |
| | 0 | 990 | | { |
| | 0 | 991 | | return ref GetCellRef(row, columnID, ref allLayerMaskColumns); |
| | 0 | 992 | | } |
| | | 993 | | |
| | | 994 | | public ref Bounds GetBoundsRef(int row, int columnID) |
| | 0 | 995 | | { |
| | 0 | 996 | | return ref GetCellRef(row, columnID, ref allBoundsColumns); |
| | 0 | 997 | | } |
| | | 998 | | |
| | | 999 | | public ref BoundsInt GetBoundsIntRef(int row, int columnID) |
| | 0 | 1000 | | { |
| | 0 | 1001 | | return ref GetCellRef(row, columnID, ref allBoundsIntColumns); |
| | 0 | 1002 | | } |
| | | 1003 | | |
| | | 1004 | | public ref Hash128 GetHash128Ref(int row, int columnID) |
| | 0 | 1005 | | { |
| | 0 | 1006 | | return ref GetCellRef(row, columnID, ref allHash128Columns); |
| | 0 | 1007 | | } |
| | | 1008 | | |
| | | 1009 | | public ref Gradient GetGradientRef(int row, int columnID) |
| | 0 | 1010 | | { |
| | 0 | 1011 | | return ref GetCellRef(row, columnID, ref allGradientColumns); |
| | 0 | 1012 | | } |
| | | 1013 | | |
| | | 1014 | | public ref AnimationCurve GetAnimationCurveRef(int row, int columnID) |
| | 0 | 1015 | | { |
| | 0 | 1016 | | return ref GetCellRef(row, columnID, ref allAnimationCurveColumns); |
| | 0 | 1017 | | } |
| | | 1018 | | |
| | | 1019 | | public ref UnityEngine.Object GetObjectRef(int row, int columnID) |
| | 0 | 1020 | | { |
| | 0 | 1021 | | return ref GetCellRef(row, columnID, ref allObjectRefColumns); |
| | 0 | 1022 | | } |
| | | 1023 | | |
| | | 1024 | | // Get Column |
| | | 1025 | | |
| | | 1026 | | public string[] GetStringColumn(int columnID) |
| | 0 | 1027 | | { |
| | 0 | 1028 | | return GetColumn(columnID, ref allStringColumns); |
| | 0 | 1029 | | } |
| | | 1030 | | |
| | | 1031 | | public bool[] GetBoolColumn(int columnID) |
| | 0 | 1032 | | { |
| | 0 | 1033 | | return GetColumn(columnID, ref allBoolColumns); |
| | 0 | 1034 | | } |
| | | 1035 | | |
| | | 1036 | | public char[] GetCharColumn(int columnID) |
| | 0 | 1037 | | { |
| | 0 | 1038 | | return GetColumn(columnID, ref allCharColumns); |
| | 0 | 1039 | | } |
| | | 1040 | | |
| | | 1041 | | public sbyte[] GetSbyteColumn(int columnID) |
| | 0 | 1042 | | { |
| | 0 | 1043 | | return GetColumn(columnID, ref allSbyteColumns); |
| | 0 | 1044 | | } |
| | | 1045 | | |
| | | 1046 | | public byte[] GetByteColumn(int columnID) |
| | 0 | 1047 | | { |
| | 0 | 1048 | | return GetColumn(columnID, ref allByteColumns); |
| | 0 | 1049 | | } |
| | | 1050 | | |
| | | 1051 | | public short[] GetShortColumn(int columnID) |
| | 0 | 1052 | | { |
| | 0 | 1053 | | return GetColumn(columnID, ref allShortColumns); |
| | 0 | 1054 | | } |
| | | 1055 | | |
| | | 1056 | | public ushort[] GetUshortColumn(int columnID) |
| | 0 | 1057 | | { |
| | 0 | 1058 | | return GetColumn(columnID, ref allUshortColumns); |
| | 0 | 1059 | | } |
| | | 1060 | | |
| | | 1061 | | public int[] GetIntColumn(int columnID) |
| | 0 | 1062 | | { |
| | 0 | 1063 | | return GetColumn(columnID, ref allIntColumns); |
| | 0 | 1064 | | } |
| | | 1065 | | |
| | | 1066 | | public uint[] GetUintColumn(int columnID) |
| | 0 | 1067 | | { |
| | 0 | 1068 | | return GetColumn(columnID, ref allUintColumns); |
| | 0 | 1069 | | } |
| | | 1070 | | |
| | | 1071 | | public long[] GetLongColumn(int columnID) |
| | 0 | 1072 | | { |
| | 0 | 1073 | | return GetColumn(columnID, ref allLongColumns); |
| | 0 | 1074 | | } |
| | | 1075 | | |
| | | 1076 | | public ulong[] GetUlongColumn(int columnID) |
| | 0 | 1077 | | { |
| | 0 | 1078 | | return GetColumn(columnID, ref allUlongColumns); |
| | 0 | 1079 | | } |
| | | 1080 | | |
| | | 1081 | | public float[] GetFloatColumn(int columnID) |
| | 0 | 1082 | | { |
| | 0 | 1083 | | return GetColumn(columnID, ref allFloatColumns); |
| | 0 | 1084 | | } |
| | | 1085 | | |
| | | 1086 | | public double[] GetDoubleColumn(int columnID) |
| | 0 | 1087 | | { |
| | 0 | 1088 | | return GetColumn(columnID, ref allDoubleColumns); |
| | 0 | 1089 | | } |
| | | 1090 | | |
| | | 1091 | | public Vector2[] GetVector2Column(int columnID) |
| | 0 | 1092 | | { |
| | 0 | 1093 | | return GetColumn(columnID, ref allVector2Columns); |
| | 0 | 1094 | | } |
| | | 1095 | | |
| | | 1096 | | public Vector3[] GetVector3Column(int columnID) |
| | 0 | 1097 | | { |
| | 0 | 1098 | | return GetColumn(columnID, ref allVector3Columns); |
| | 0 | 1099 | | } |
| | | 1100 | | |
| | | 1101 | | public Vector4[] GetVector4Column(int columnID) |
| | 0 | 1102 | | { |
| | 0 | 1103 | | return GetColumn(columnID, ref allVector4Columns); |
| | 0 | 1104 | | } |
| | | 1105 | | |
| | | 1106 | | public Vector2Int[] GetVector2IntColumn(int columnID) |
| | 0 | 1107 | | { |
| | 0 | 1108 | | return GetColumn(columnID, ref allVector2IntColumns); |
| | 0 | 1109 | | } |
| | | 1110 | | |
| | | 1111 | | public Vector3Int[] GetVector3IntColumn(int columnID) |
| | 0 | 1112 | | { |
| | 0 | 1113 | | return GetColumn(columnID, ref allVector3IntColumns); |
| | 0 | 1114 | | } |
| | | 1115 | | |
| | | 1116 | | public Quaternion[] GetQuaternionColumn(int columnID) |
| | 0 | 1117 | | { |
| | 0 | 1118 | | return GetColumn(columnID, ref allQuaternionColumns); |
| | 0 | 1119 | | } |
| | | 1120 | | |
| | | 1121 | | public Rect[] GetRectColumn(int columnID) |
| | 0 | 1122 | | { |
| | 0 | 1123 | | return GetColumn(columnID, ref allRectColumns); |
| | 0 | 1124 | | } |
| | | 1125 | | |
| | | 1126 | | public RectInt[] GetRectIntColumn(int columnID) |
| | 0 | 1127 | | { |
| | 0 | 1128 | | return GetColumn(columnID, ref allRectIntColumns); |
| | 0 | 1129 | | } |
| | | 1130 | | |
| | | 1131 | | public Color[] GetColorColumn(int columnID) |
| | 0 | 1132 | | { |
| | 0 | 1133 | | return GetColumn(columnID, ref allColorColumns); |
| | 0 | 1134 | | } |
| | | 1135 | | |
| | | 1136 | | public LayerMask[] GetLayerMaskColumn(int columnID) |
| | 0 | 1137 | | { |
| | 0 | 1138 | | return GetColumn(columnID, ref allLayerMaskColumns); |
| | 0 | 1139 | | } |
| | | 1140 | | |
| | | 1141 | | public Bounds[] GetBoundsColumn(int columnID) |
| | 0 | 1142 | | { |
| | 0 | 1143 | | return GetColumn(columnID, ref allBoundsColumns); |
| | 0 | 1144 | | } |
| | | 1145 | | |
| | | 1146 | | public BoundsInt[] GetBoundsIntColumn(int columnID) |
| | 0 | 1147 | | { |
| | 0 | 1148 | | return GetColumn(columnID, ref allBoundsIntColumns); |
| | 0 | 1149 | | } |
| | | 1150 | | |
| | | 1151 | | public Hash128[] GetHash128Column(int columnID) |
| | 0 | 1152 | | { |
| | 0 | 1153 | | return GetColumn(columnID, ref allHash128Columns); |
| | 0 | 1154 | | } |
| | | 1155 | | |
| | | 1156 | | public Gradient[] GetGradientColumn(int columnID) |
| | 0 | 1157 | | { |
| | 0 | 1158 | | return GetColumn(columnID, ref allGradientColumns); |
| | 0 | 1159 | | } |
| | | 1160 | | |
| | | 1161 | | public AnimationCurve[] GetAnimationCurveColumn(int columnID) |
| | 0 | 1162 | | { |
| | 0 | 1163 | | return GetColumn(columnID, ref allAnimationCurveColumns); |
| | 0 | 1164 | | } |
| | | 1165 | | |
| | | 1166 | | public UnityEngine.Object[] GetObjectColumn(int columnID) |
| | 0 | 1167 | | { |
| | 0 | 1168 | | return GetColumn(columnID, ref allObjectRefColumns); |
| | 0 | 1169 | | } |
| | | 1170 | | |
| | | 1171 | | // Internal |
| | | 1172 | | |
| | | 1173 | | internal int AddColumnInternal<T>(string columnName, ref T[][] allColumnsOfType, ColumnType typeIndex, int inser |
| | 0 | 1174 | | { |
| | 0 | 1175 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1176 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| | 0 | 1177 | | allColumnsOfType[columnCount] = new T[rowCount]; |
| | | 1178 | | |
| | 0 | 1179 | | string[] columnNamesForType = allColumnNames[(int)typeIndex]; |
| | 0 | 1180 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| | 0 | 1181 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| | 0 | 1182 | | columnNamesForType[columnNamesCount] = columnName; |
| | 0 | 1183 | | allColumnNames[(int)typeIndex] = columnNamesForType; |
| | | 1184 | | |
| | 0 | 1185 | | int columnIndex = columnEntriesFreeListHead; |
| | 0 | 1186 | | int columnIDToDenseIndexMapLength = columnIDToDenseIndexMap?.Length ?? 0; |
| | 0 | 1187 | | if (columnIndex >= columnIDToDenseIndexMapLength) |
| | 0 | 1188 | | { |
| | 0 | 1189 | | Array.Resize(ref columnIDToDenseIndexMap, columnIndex * 2); |
| | 0 | 1190 | | for (int i = 0; i < columnIndex; i++) |
| | 0 | 1191 | | { |
| | 0 | 1192 | | ref ColumnEntry entry = ref columnIDToDenseIndexMap[columnIndex + i]; |
| | 0 | 1193 | | entry.columnDenseIndex = columnIndex + i + 1; |
| | 0 | 1194 | | entry.columnType = ColumnType.Invalid; |
| | 0 | 1195 | | } |
| | 0 | 1196 | | } |
| | | 1197 | | |
| | 0 | 1198 | | ref int[] denseIndexToIDMap = ref columnDenseIndexToIDMap[(int)typeIndex]; |
| | 0 | 1199 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| | 0 | 1200 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| | 0 | 1201 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnIndex; |
| | | 1202 | | |
| | 0 | 1203 | | ref ColumnEntry newEntry = ref columnIDToDenseIndexMap[columnIndex]; |
| | 0 | 1204 | | newEntry.columnDenseIndex = denseIndexToIDMapLength; |
| | 0 | 1205 | | newEntry.columnType = typeIndex; |
| | | 1206 | | |
| | 0 | 1207 | | insertAt = insertAt < 0 ? combinedColumnCount + 1 : insertAt; |
| | 0 | 1208 | | ref int[] columnOrdersOfType = ref allColumnOrders[(int)typeIndex]; |
| | 0 | 1209 | | int columnOrdersOfTypeLength = columnOrdersOfType?.Length ?? 0; |
| | 0 | 1210 | | Array.Resize(ref columnOrdersOfType, columnOrdersOfTypeLength + 1); |
| | 0 | 1211 | | columnOrdersOfType[columnOrdersOfTypeLength] = insertAt; |
| | | 1212 | | |
| | 0 | 1213 | | for (int i = 0; i < (int)ColumnType.Count; i++) |
| | 0 | 1214 | | { |
| | 0 | 1215 | | int[] columnOrdersOfTypeCurrent = allColumnOrders[i]; |
| | | 1216 | | |
| | 0 | 1217 | | int columnOrdersLength = columnOrdersOfTypeCurrent.Length; |
| | 0 | 1218 | | for (int j = 0; j < columnOrdersLength; j++) |
| | 0 | 1219 | | { |
| | 0 | 1220 | | int columnOrderCurrent = columnOrdersOfTypeCurrent[j]; |
| | | 1221 | | |
| | 0 | 1222 | | if (columnOrderCurrent > insertAt) |
| | 0 | 1223 | | { |
| | 0 | 1224 | | columnOrdersOfType[j] = columnOrderCurrent + 1; |
| | 0 | 1225 | | } |
| | 0 | 1226 | | } |
| | 0 | 1227 | | } |
| | | 1228 | | |
| | 0 | 1229 | | ++combinedColumnCount; |
| | 0 | 1230 | | return columnIndex; |
| | 0 | 1231 | | } |
| | | 1232 | | |
| | | 1233 | | internal void RemoveColumnInternal<T>(ref T[][] allColumnsOfType, ColumnType typeIndex, int columnID) |
| | 0 | 1234 | | { |
| | 0 | 1235 | | int columnLocation = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | | 1236 | | |
| | 0 | 1237 | | int lastIndex = allColumnsOfType.Length - 1; |
| | 0 | 1238 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| | 0 | 1239 | | T[][] newColumnArray = new T[lastIndex][]; |
| | 0 | 1240 | | Array.Copy(allColumnsOfType, 0, newColumnArray, 0, lastIndex); |
| | 0 | 1241 | | allColumnsOfType = newColumnArray; |
| | | 1242 | | |
| | 0 | 1243 | | string[] columnNamesOfType = allColumnNames[(int)typeIndex]; |
| | 0 | 1244 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| | 0 | 1245 | | string[] newColumnNamesOfType = new string[lastIndex]; |
| | 0 | 1246 | | Array.Copy(columnNamesOfType, 0, newColumnNamesOfType, 0, lastIndex); |
| | 0 | 1247 | | allColumnNames[(int)typeIndex] = newColumnNamesOfType; |
| | | 1248 | | |
| | 0 | 1249 | | int[] columnOrdersOfType = allColumnOrders[(int)typeIndex]; |
| | 0 | 1250 | | int columnOrder = columnOrdersOfType[columnLocation]; |
| | 0 | 1251 | | columnOrdersOfType[columnLocation] = columnOrdersOfType[lastIndex]; |
| | 0 | 1252 | | int[] newColumnOrdersOfType = new int[lastIndex]; |
| | 0 | 1253 | | Array.Copy(columnOrdersOfType, 0, newColumnOrdersOfType, 0, lastIndex); |
| | 0 | 1254 | | allColumnOrders[(int)typeIndex] = newColumnOrdersOfType; |
| | | 1255 | | |
| | 0 | 1256 | | int[] denseIndicesOfType = columnDenseIndexToIDMap[(int)typeIndex]; |
| | 0 | 1257 | | int sparseIndexAt = denseIndicesOfType[columnLocation]; |
| | 0 | 1258 | | int sparseIndexToSwap = columnOrdersOfType[lastIndex]; |
| | 0 | 1259 | | ref ColumnEntry sparseIndexToFree = ref columnIDToDenseIndexMap[sparseIndexAt]; |
| | 0 | 1260 | | sparseIndexToFree.columnType = ColumnType.Invalid; |
| | 0 | 1261 | | sparseIndexToFree.columnDenseIndex = columnEntriesFreeListHead; |
| | 0 | 1262 | | columnEntriesFreeListHead = sparseIndexAt; |
| | 0 | 1263 | | columnIDToDenseIndexMap[sparseIndexToSwap].columnDenseIndex = columnLocation; |
| | 0 | 1264 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| | 0 | 1265 | | int[] newDenseIndicesOfType = new int[lastIndex]; |
| | 0 | 1266 | | Array.Copy(denseIndicesOfType, 0, newDenseIndicesOfType, 0, lastIndex); |
| | 0 | 1267 | | columnDenseIndexToIDMap[(int)typeIndex] = newDenseIndicesOfType; |
| | | 1268 | | |
| | 0 | 1269 | | for (int i = 0; i < (int)ColumnType.Count; i++) |
| | 0 | 1270 | | { |
| | 0 | 1271 | | int[] columnOrdersOfTypeCurrent = allColumnOrders[i]; |
| | | 1272 | | |
| | 0 | 1273 | | int columnOrdersLength = columnOrdersOfTypeCurrent.Length; |
| | 0 | 1274 | | for (int j = 0; j < columnOrdersLength; j++) |
| | 0 | 1275 | | { |
| | 0 | 1276 | | int columnOrderCurrent = columnOrdersOfTypeCurrent[j]; |
| | | 1277 | | |
| | 0 | 1278 | | if (columnOrderCurrent > columnOrder) |
| | 0 | 1279 | | { |
| | 0 | 1280 | | columnOrdersOfType[j] = columnOrderCurrent - 1; |
| | 0 | 1281 | | } |
| | 0 | 1282 | | } |
| | 0 | 1283 | | } |
| | | 1284 | | |
| | 0 | 1285 | | --combinedColumnCount; |
| | 0 | 1286 | | } |
| | | 1287 | | |
| | | 1288 | | internal void InsertRowsOfTypeInternal<T>(ref T[][] allColumnsOfType, int insertAt, int numberOfNewRows) |
| | 0 | 1289 | | { |
| | 0 | 1290 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 0 | 1291 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1292 | | { |
| | 0 | 1293 | | ref T[] column = ref allColumnsOfType[i]; |
| | 0 | 1294 | | int newRowCount = rowCount + numberOfNewRows; |
| | 0 | 1295 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1296 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| | 0 | 1297 | | { |
| | 0 | 1298 | | column[j] = column[j - numberOfNewRows]; |
| | 0 | 1299 | | } |
| | | 1300 | | |
| | 0 | 1301 | | for (int j = 0; j < numberOfNewRows; j++) |
| | 0 | 1302 | | { |
| | 0 | 1303 | | column[insertAt + i] = default; |
| | 0 | 1304 | | } |
| | 0 | 1305 | | } |
| | 0 | 1306 | | } |
| | | 1307 | | |
| | | 1308 | | internal void DeleteRowsOfTypeInternal<T>(ref T[][] allColumnsOfType, int removeAt, int numberOfRowsToDelete) |
| | 0 | 1309 | | { |
| | 0 | 1310 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | | 1311 | | |
| | 0 | 1312 | | for (int i = 0; i < columnCount; i++) |
| | 0 | 1313 | | { |
| | 0 | 1314 | | ref T[] column = ref allColumnsOfType[i]; |
| | 0 | 1315 | | int newRowCount = rowCount - numberOfRowsToDelete; |
| | | 1316 | | |
| | 0 | 1317 | | for (int j = removeAt; j < rowCount - numberOfRowsToDelete; j++) |
| | 0 | 1318 | | { |
| | 0 | 1319 | | column[j] = column[j + numberOfRowsToDelete]; |
| | 0 | 1320 | | } |
| | | 1321 | | |
| | 0 | 1322 | | Array.Resize(ref column, newRowCount); |
| | 0 | 1323 | | } |
| | 0 | 1324 | | } |
| | | 1325 | | |
| | | 1326 | | internal ref T GetCellRef<T>(int row, int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1327 | | { |
| | 0 | 1328 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1329 | | return ref allColumnsOfType[column][row]; |
| | 0 | 1330 | | } |
| | | 1331 | | |
| | | 1332 | | internal T GetCell<T>(int row, int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1333 | | { |
| | 0 | 1334 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1335 | | return allColumnsOfType[column][row]; |
| | 0 | 1336 | | } |
| | | 1337 | | |
| | | 1338 | | internal void SetCell<T>(int row, int columnID, ref T[][] allColumnsOfType, T value) |
| | 0 | 1339 | | { |
| | 0 | 1340 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1341 | | allColumnsOfType[column][row] = value; |
| | 0 | 1342 | | } |
| | | 1343 | | |
| | | 1344 | | internal T[] GetColumn<T>(int columnID, ref T[][] allColumnsOfType) |
| | 0 | 1345 | | { |
| | 0 | 1346 | | int column = columnIDToDenseIndexMap[columnID].columnDenseIndex; |
| | 0 | 1347 | | return allColumnsOfType[column]; |
| | 0 | 1348 | | } |
| | | 1349 | | } |
| | | 1350 | | } |